package mongodb

const (
	F_STRING   = "string"
	F_INT      = "int64"
	F_BOOL     = "bool"
	F_FLOAT    = "float64"
	F_TIME     = "time.Time"
	F_A_INT    = "[]int64"
	F_A_FLOAT  = "[]float64"
	F_A_STRING = "[]string"
	F_O2M      = "[]*"
	F_O2O      = "*"
	F_MAP      = "bson.M"
	F_A_MAP    = "[]bson.M"
)

type Field struct {
	Name   string
	CnName string
	ReName string
	Type   string
	Src    string
}

func (this *Field) GetName() string           { return this.Name }
func (this *Field) SetName(v string) *Field   { this.Name = v; return this }
func (this *Field) GetCnName() string         { return this.CnName }
func (this *Field) SetCnName(v string) *Field { this.CnName = v; return this }
func (this *Field) GetReName() string         { return this.ReName }
func (this *Field) SetReName(v string) *Field { this.ReName = v; return this }
func (this *Field) GetType() string           { return this.Type }
func (this *Field) SetType(v string) *Field   { this.Type = v; return this }
func (this *Field) GetSrc() string            { return this.Src }
func (this *Field) SetSrc(v string) *Field    { this.Src = v; return this }
func (this *Field) GetConfig() *Field         { return this }
func (this *Field) CreateConfig() *Field      { return this }

func (this *Field) IsString() *Field      { this.Type = F_STRING; return this }
func (this *Field) IsInt() *Field         { this.Type = F_INT; return this }
func (this *Field) IsFloat() *Field       { this.Type = F_FLOAT; return this }
func (this *Field) IsBool() *Field        { this.Type = F_BOOL; return this }
func (this *Field) IsTime() *Field        { this.Type = F_TIME; return this }
func (this *Field) IsArrayInt() *Field    { this.Type = F_A_INT; return this }
func (this *Field) IsArrayFloat() *Field  { this.Type = F_A_FLOAT; return this }
func (this *Field) IsArrayString() *Field { this.Type = F_A_STRING; return this }
func (this *Field) IsO20() *Field         { this.Type = F_O2O; return this }
func (this *Field) IsO2M() *Field         { this.Type = F_O2M; return this }
func (this *Field) IsMap() *Field         { this.Type = F_MAP; return this }
func (this *Field) IsArrayMap() *Field    { this.Type = F_A_MAP; return this }
